{
struct domain *d;
- for_each_domain(d)
- if (d->domain_id != 0)
+ for_each_domain ( d )
+ if ( d->domain_id != 0 )
domain_pause(d);
}
{
struct domain *d;
- for_each_domain(d)
- if (d->domain_id != 0)
+ for_each_domain ( d )
+ if ( d->domain_id != 0 )
domain_unpause(d);
}
wakeup_vector_va = __acpi_map_table(
acpi_sinfo.wakeup_vector, sizeof(uint64_t));
- if (acpi_sinfo.vector_width == 32)
+ if ( acpi_sinfo.vector_width == 32 )
*(uint32_t *)wakeup_vector_va =
(uint32_t)bootsym_phys(wakeup_start);
else
unsigned long flags;
int error;
- if (state <= ACPI_STATE_S0 || state > ACPI_S_STATES_MAX)
+ if ( (state <= ACPI_STATE_S0) || (state > ACPI_S_STATES_MAX) )
return -EINVAL;
__sync_lazy_execstate();
pmprintk(XENLOG_INFO, "Flush lazy state\n");
- if (!spin_trylock(&pm_lock))
+ if ( !spin_trylock(&pm_lock) )
return -EBUSY;
pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n",
freeze_domains();
disable_nonboot_cpus();
- if (num_online_cpus() != 1)
+ if ( num_online_cpus() != 1 )
{
error = -EBUSY;
goto Enable_cpu;
local_irq_save(flags);
- if ((error = device_power_down()))
+ if ( (error = device_power_down()) )
{
printk(XENLOG_ERR "Some devices failed to power down\n");
goto Done;
ACPI_FLUSH_CPU_CACHE();
- switch (state)
+ switch ( state )
{
case ACPI_STATE_S3:
do_suspend_lowlevel();
ACPI_FLUSH_CPU_CACHE();
outw((u16)acpi_sinfo.pm1a_cnt_val, acpi_sinfo.pm1a_cnt);
- if (acpi_sinfo.pm1b_cnt)
+ if ( acpi_sinfo.pm1b_cnt )
outw((u16)acpi_sinfo.pm1b_cnt_val, acpi_sinfo.pm1b_cnt);
/* Wait until we enter sleep state, and spin until we wake */
- while (!acpi_get_wake_status());
+ while ( !acpi_get_wake_status() )
+ continue;
+
return_ACPI_STATUS(AE_OK);
}
/*
- * Suspend support specific for i386.
- *
- * Distribute under GPLv2
- *
- * Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
- * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
+ * Portions are:
+ * Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
+ * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
*/
+
#include <xen/config.h>
#include <xen/acpi.h>
#include <xen/smp.h>
#include <asm/hvm/support.h>
#include <asm/i387.h>
-/* Following context save/restore happens on the real context
- * of current vcpu, with a lazy state sync forced earlier.
- */
#if defined(CONFIG_X86_64)
-unsigned long saved_lstar, saved_cstar;
+static unsigned long saved_lstar, saved_cstar;
#endif
+
void save_rest_processor_state(void)
{
- /*
- * Net effect of unlazy_fpu is to set cr0.ts and thus there's no
- * need to restore fpu after resume.
- */
- if (!is_idle_vcpu(current))
+ if ( !is_idle_vcpu(current) )
unlazy_fpu(current);
#if defined(CONFIG_X86_64)
struct tss_struct *t = &init_tss[cpu];
struct vcpu *v = current;
- /* Really scared by suffixed comment from Linux, and keep it for safe */
- set_tss_desc(cpu, t); /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
-
+ set_tss_desc(cpu, t);
load_TR(cpu);
#if defined(CONFIG_X86_64)
wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS);
wrmsr(MSR_SYSCALL_MASK, EF_VM|EF_RF|EF_NT|EF_DF|EF_IE|EF_TF, 0U);
#else /* !defined(CONFIG_X86_64) */
- if (supervisor_mode_kernel && cpu_has_sep)
+ if ( supervisor_mode_kernel && cpu_has_sep )
wrmsr(MSR_IA32_SYSENTER_ESP, &t->esp1, 0);
#endif
loaddebug(&v->arch.guest_context, 7);
}
- /* Do we start fpu really? Just set cr0.ts to monitor it */
+ /* Reload FPU state on next FPU use. */
stts();
mtrr_ap_init();